

//查找用户在指定节点上拥有的权限（通过该用户id及所属角色）
var v_script_id = 'auth_on_node';
//脚本状态,0:该脚本不许执行，1:该脚本可以执行
var v_status = '1';

//脚本逻辑写在run语句之间
if (run && action.getAuthority().is(5,"9")){
	var user = action.getSession().getAttribute("user");
	var authid = action.form.getInteger('authid');
	//var pcolvalue = action.form.getInteger('pcolvalue');
	var condition = '';
	if(user.getRolekind()>=3){
		condition = ' where authid = ' + authid ;//+ ' and pcolvalue=' + pcolvalue ; 
		if (user.getRoleids('roleid','or') == null){
			condition += ' and userid = '+ user.getId() ;
		}else{
			condition += ' and (' + user.getRoleids('roleid','or') + ' or userid = '+ user.getId() +')';
		}
		action.vars.put(action.V_CONDITION, condition );//数据检索条件
		action.vars.put(action.V_TABLE_NAME,'v_auth_all');//指定获取数据的表名
	}else{
		var list = action.buildArrayList();
		var map = action.buildHashMap();
		map.put("rolekind",user.getRolekind());
		list.add(map);
		action.setRecorders(list);
	}
	
}